start   previous   next

Shout3D™ 2.0 - Workflow Tutorial

Adding user interactivity

Adding user interactivity means making use of the methods in the Shout3D API (application programming interface).

Let's say we want the user to be able to start and stop the animation. This involves giving the user control over the TimeSensor node in the scene. Go to the index page of your javadocs online documentation, and scroll down the list of classes on the left until you find the TimeSensor class. Click on this link to bring up information about the TimeSensor.

Scroll down the TimeSensor page to the Method Summary section. This section lists all of the Java methods you can use to control the TimeSensor. You can start and stop the TimeSensor with the start() and stop() methods. If you stop the TimeSensor and start it again, it restarts from the beginning of the animation. To stop and restart the TimeSensor from where it left off, you can use the setPaused() method to pause and unpause the animation. You'll need the isPaused()method to determine whether the TimeSensor is currently paused or not.

In Java, you call the method for a given object by using a reference to that object. For example, if we have a reference to our TimeSensor named myTimer, we can stop it with myTimer.stop(). This calls the stop() method for this particular TimeSensor. (There could be more than one TimerSensor in the scene if there were multiple pieces of animation.)

Next>


Copyright� 1999-2000, Eyematic Interfaces, Inc.